3.41 \(\int \frac{\cot ^2(c+d x) (A+B \tan (c+d x))}{a+i a \tan (c+d x)} \, dx\)

Optimal. Leaf size=102 \[ -\frac{(3 A+i B) \cot (c+d x)}{2 a d}-\frac{(-B+i A) \log (\sin (c+d x))}{a d}+\frac{(A+i B) \cot (c+d x)}{2 d (a+i a \tan (c+d x))}-\frac{x (3 A+i B)}{2 a} \]

[Out]

-((3*A + I*B)*x)/(2*a) - ((3*A + I*B)*Cot[c + d*x])/(2*a*d) - ((I*A - B)*Log[Sin[c + d*x]])/(a*d) + ((A + I*B)
*Cot[c + d*x])/(2*d*(a + I*a*Tan[c + d*x]))

________________________________________________________________________________________

Rubi [A]  time = 0.174708, antiderivative size = 102, normalized size of antiderivative = 1., number of steps used = 4, number of rules used = 4, integrand size = 34, \(\frac{\text{number of rules}}{\text{integrand size}}\) = 0.118, Rules used = {3596, 3529, 3531, 3475} \[ -\frac{(3 A+i B) \cot (c+d x)}{2 a d}-\frac{(-B+i A) \log (\sin (c+d x))}{a d}+\frac{(A+i B) \cot (c+d x)}{2 d (a+i a \tan (c+d x))}-\frac{x (3 A+i B)}{2 a} \]

Antiderivative was successfully verified.

[In]

Int[(Cot[c + d*x]^2*(A + B*Tan[c + d*x]))/(a + I*a*Tan[c + d*x]),x]

[Out]

-((3*A + I*B)*x)/(2*a) - ((3*A + I*B)*Cot[c + d*x])/(2*a*d) - ((I*A - B)*Log[Sin[c + d*x]])/(a*d) + ((A + I*B)
*Cot[c + d*x])/(2*d*(a + I*a*Tan[c + d*x]))

Rule 3596

Int[((a_) + (b_.)*tan[(e_.) + (f_.)*(x_)])^(m_)*((A_.) + (B_.)*tan[(e_.) + (f_.)*(x_)])*((c_.) + (d_.)*tan[(e_
.) + (f_.)*(x_)])^(n_), x_Symbol] :> Simp[((a*A + b*B)*(a + b*Tan[e + f*x])^m*(c + d*Tan[e + f*x])^(n + 1))/(2
*f*m*(b*c - a*d)), x] + Dist[1/(2*a*m*(b*c - a*d)), Int[(a + b*Tan[e + f*x])^(m + 1)*(c + d*Tan[e + f*x])^n*Si
mp[A*(b*c*m - a*d*(2*m + n + 1)) + B*(a*c*m - b*d*(n + 1)) + d*(A*b - a*B)*(m + n + 1)*Tan[e + f*x], x], x], x
] /; FreeQ[{a, b, c, d, e, f, A, B, n}, x] && NeQ[b*c - a*d, 0] && EqQ[a^2 + b^2, 0] && LtQ[m, 0] &&  !GtQ[n,
0]

Rule 3529

Int[((a_.) + (b_.)*tan[(e_.) + (f_.)*(x_)])^(m_)*((c_.) + (d_.)*tan[(e_.) + (f_.)*(x_)]), x_Symbol] :> Simp[((
b*c - a*d)*(a + b*Tan[e + f*x])^(m + 1))/(f*(m + 1)*(a^2 + b^2)), x] + Dist[1/(a^2 + b^2), Int[(a + b*Tan[e +
f*x])^(m + 1)*Simp[a*c + b*d - (b*c - a*d)*Tan[e + f*x], x], x], x] /; FreeQ[{a, b, c, d, e, f}, x] && NeQ[b*c
 - a*d, 0] && NeQ[a^2 + b^2, 0] && LtQ[m, -1]

Rule 3531

Int[((c_.) + (d_.)*tan[(e_.) + (f_.)*(x_)])/((a_.) + (b_.)*tan[(e_.) + (f_.)*(x_)]), x_Symbol] :> Simp[((a*c +
 b*d)*x)/(a^2 + b^2), x] + Dist[(b*c - a*d)/(a^2 + b^2), Int[(b - a*Tan[e + f*x])/(a + b*Tan[e + f*x]), x], x]
 /; FreeQ[{a, b, c, d, e, f}, x] && NeQ[b*c - a*d, 0] && NeQ[a^2 + b^2, 0] && NeQ[a*c + b*d, 0]

Rule 3475

Int[tan[(c_.) + (d_.)*(x_)], x_Symbol] :> -Simp[Log[RemoveContent[Cos[c + d*x], x]]/d, x] /; FreeQ[{c, d}, x]

Rubi steps

\begin{align*} \int \frac{\cot ^2(c+d x) (A+B \tan (c+d x))}{a+i a \tan (c+d x)} \, dx &=\frac{(A+i B) \cot (c+d x)}{2 d (a+i a \tan (c+d x))}+\frac{\int \cot ^2(c+d x) (a (3 A+i B)-2 a (i A-B) \tan (c+d x)) \, dx}{2 a^2}\\ &=-\frac{(3 A+i B) \cot (c+d x)}{2 a d}+\frac{(A+i B) \cot (c+d x)}{2 d (a+i a \tan (c+d x))}+\frac{\int \cot (c+d x) (-2 a (i A-B)-a (3 A+i B) \tan (c+d x)) \, dx}{2 a^2}\\ &=-\frac{(3 A+i B) x}{2 a}-\frac{(3 A+i B) \cot (c+d x)}{2 a d}+\frac{(A+i B) \cot (c+d x)}{2 d (a+i a \tan (c+d x))}-\frac{(i A-B) \int \cot (c+d x) \, dx}{a}\\ &=-\frac{(3 A+i B) x}{2 a}-\frac{(3 A+i B) \cot (c+d x)}{2 a d}-\frac{(i A-B) \log (\sin (c+d x))}{a d}+\frac{(A+i B) \cot (c+d x)}{2 d (a+i a \tan (c+d x))}\\ \end{align*}

Mathematica [B]  time = 2.70133, size = 225, normalized size = 2.21 \[ \frac{(\cos (d x)+i \sin (d x)) (A+B \tan (c+d x)) \left (\frac{1}{2} (B-i A) (\cos (c)-i \sin (c)) \cos (2 d x)-\frac{1}{2} (A+i B) (\cos (c)-i \sin (c)) \sin (2 d x)+2 d x (A+i B) (\cos (c)+i \sin (c))-d x (3 A+i B) (\cos (c)+i \sin (c))+(B-i A) (\cos (c)+i \sin (c)) \log \left (\sin ^2(c+d x)\right )-2 (A+i B) (\cos (c)+i \sin (c)) \tan ^{-1}(\tan (d x))+2 A (\cot (c)+i) \sin (d x) \csc (c+d x)\right )}{2 d (a+i a \tan (c+d x)) (A \cos (c+d x)+B \sin (c+d x))} \]

Antiderivative was successfully verified.

[In]

Integrate[(Cot[c + d*x]^2*(A + B*Tan[c + d*x]))/(a + I*a*Tan[c + d*x]),x]

[Out]

((Cos[d*x] + I*Sin[d*x])*((((-I)*A + B)*Cos[2*d*x]*(Cos[c] - I*Sin[c]))/2 + 2*(A + I*B)*d*x*(Cos[c] + I*Sin[c]
) - (3*A + I*B)*d*x*(Cos[c] + I*Sin[c]) - 2*(A + I*B)*ArcTan[Tan[d*x]]*(Cos[c] + I*Sin[c]) + ((-I)*A + B)*Log[
Sin[c + d*x]^2]*(Cos[c] + I*Sin[c]) + 2*A*(I + Cot[c])*Csc[c + d*x]*Sin[d*x] - ((A + I*B)*(Cos[c] - I*Sin[c])*
Sin[2*d*x])/2)*(A + B*Tan[c + d*x]))/(2*d*(A*Cos[c + d*x] + B*Sin[c + d*x])*(a + I*a*Tan[c + d*x]))

________________________________________________________________________________________

Maple [A]  time = 0.096, size = 170, normalized size = 1.7 \begin{align*} -{\frac{A}{2\,ad \left ( \tan \left ( dx+c \right ) -i \right ) }}-{\frac{{\frac{i}{2}}B}{ad \left ( \tan \left ( dx+c \right ) -i \right ) }}+{\frac{{\frac{5\,i}{4}}\ln \left ( \tan \left ( dx+c \right ) -i \right ) A}{ad}}-{\frac{3\,\ln \left ( \tan \left ( dx+c \right ) -i \right ) B}{4\,ad}}-{\frac{B\ln \left ( \tan \left ( dx+c \right ) +i \right ) }{4\,ad}}-{\frac{{\frac{i}{4}}A\ln \left ( \tan \left ( dx+c \right ) +i \right ) }{ad}}-{\frac{A}{ad\tan \left ( dx+c \right ) }}-{\frac{iA\ln \left ( \tan \left ( dx+c \right ) \right ) }{ad}}+{\frac{B\ln \left ( \tan \left ( dx+c \right ) \right ) }{ad}} \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

int(cot(d*x+c)^2*(A+B*tan(d*x+c))/(a+I*a*tan(d*x+c)),x)

[Out]

-1/2/d/a/(tan(d*x+c)-I)*A-1/2*I/d/a/(tan(d*x+c)-I)*B+5/4*I/d/a*ln(tan(d*x+c)-I)*A-3/4/d/a*ln(tan(d*x+c)-I)*B-1
/4/d/a*B*ln(tan(d*x+c)+I)-1/4*I/d/a*A*ln(tan(d*x+c)+I)-1/d/a*A/tan(d*x+c)-I/d/a*A*ln(tan(d*x+c))+1/d/a*B*ln(ta
n(d*x+c))

________________________________________________________________________________________

Maxima [F(-2)]  time = 0., size = 0, normalized size = 0. \begin{align*} \text{Exception raised: RuntimeError} \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(cot(d*x+c)^2*(A+B*tan(d*x+c))/(a+I*a*tan(d*x+c)),x, algorithm="maxima")

[Out]

Exception raised: RuntimeError

________________________________________________________________________________________

Fricas [A]  time = 1.54263, size = 365, normalized size = 3.58 \begin{align*} -\frac{2 \,{\left (5 \, A + 3 i \, B\right )} d x e^{\left (4 i \, d x + 4 i \, c\right )} -{\left (2 \,{\left (5 \, A + 3 i \, B\right )} d x - 9 i \, A + B\right )} e^{\left (2 i \, d x + 2 i \, c\right )} -{\left ({\left (-4 i \, A + 4 \, B\right )} e^{\left (4 i \, d x + 4 i \, c\right )} +{\left (4 i \, A - 4 \, B\right )} e^{\left (2 i \, d x + 2 i \, c\right )}\right )} \log \left (e^{\left (2 i \, d x + 2 i \, c\right )} - 1\right ) - i \, A + B}{4 \,{\left (a d e^{\left (4 i \, d x + 4 i \, c\right )} - a d e^{\left (2 i \, d x + 2 i \, c\right )}\right )}} \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(cot(d*x+c)^2*(A+B*tan(d*x+c))/(a+I*a*tan(d*x+c)),x, algorithm="fricas")

[Out]

-1/4*(2*(5*A + 3*I*B)*d*x*e^(4*I*d*x + 4*I*c) - (2*(5*A + 3*I*B)*d*x - 9*I*A + B)*e^(2*I*d*x + 2*I*c) - ((-4*I
*A + 4*B)*e^(4*I*d*x + 4*I*c) + (4*I*A - 4*B)*e^(2*I*d*x + 2*I*c))*log(e^(2*I*d*x + 2*I*c) - 1) - I*A + B)/(a*
d*e^(4*I*d*x + 4*I*c) - a*d*e^(2*I*d*x + 2*I*c))

________________________________________________________________________________________

Sympy [A]  time = 3.99142, size = 151, normalized size = 1.48 \begin{align*} - \frac{2 i A e^{- 2 i c}}{a d \left (e^{2 i d x} - e^{- 2 i c}\right )} - \frac{\left (\begin{cases} 5 A x e^{2 i c} + \frac{i A e^{- 2 i d x}}{2 d} + 3 i B x e^{2 i c} - \frac{B e^{- 2 i d x}}{2 d} & \text{for}\: d \neq 0 \\x \left (5 A e^{2 i c} + A + 3 i B e^{2 i c} + i B\right ) & \text{otherwise} \end{cases}\right ) e^{- 2 i c}}{2 a} + \frac{\left (- i A + B\right ) \log{\left (e^{2 i d x} - e^{- 2 i c} \right )}}{a d} \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(cot(d*x+c)**2*(A+B*tan(d*x+c))/(a+I*a*tan(d*x+c)),x)

[Out]

-2*I*A*exp(-2*I*c)/(a*d*(exp(2*I*d*x) - exp(-2*I*c))) - Piecewise((5*A*x*exp(2*I*c) + I*A*exp(-2*I*d*x)/(2*d)
+ 3*I*B*x*exp(2*I*c) - B*exp(-2*I*d*x)/(2*d), Ne(d, 0)), (x*(5*A*exp(2*I*c) + A + 3*I*B*exp(2*I*c) + I*B), Tru
e))*exp(-2*I*c)/(2*a) + (-I*A + B)*log(exp(2*I*d*x) - exp(-2*I*c))/(a*d)

________________________________________________________________________________________

Giac [A]  time = 1.40134, size = 184, normalized size = 1.8 \begin{align*} -\frac{\frac{2 \,{\left (-5 i \, A + 3 \, B\right )} \log \left (\tan \left (d x + c\right ) - i\right )}{a} + \frac{2 \,{\left (i \, A + B\right )} \log \left (-i \, \tan \left (d x + c\right ) + 1\right )}{a} + \frac{8 \,{\left (i \, A - B\right )} \log \left ({\left | \tan \left (d x + c\right ) \right |}\right )}{a} + \frac{A \tan \left (d x + c\right )^{2} - i \, B \tan \left (d x + c\right )^{2} - 13 i \, A \tan \left (d x + c\right ) + 3 \, B \tan \left (d x + c\right ) - 8 \, A}{{\left (-i \, \tan \left (d x + c\right )^{2} - \tan \left (d x + c\right )\right )} a}}{8 \, d} \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(cot(d*x+c)^2*(A+B*tan(d*x+c))/(a+I*a*tan(d*x+c)),x, algorithm="giac")

[Out]

-1/8*(2*(-5*I*A + 3*B)*log(tan(d*x + c) - I)/a + 2*(I*A + B)*log(-I*tan(d*x + c) + 1)/a + 8*(I*A - B)*log(abs(
tan(d*x + c)))/a + (A*tan(d*x + c)^2 - I*B*tan(d*x + c)^2 - 13*I*A*tan(d*x + c) + 3*B*tan(d*x + c) - 8*A)/((-I
*tan(d*x + c)^2 - tan(d*x + c))*a))/d